package com.zc.zby.basicframedemo.viewholder;

import android.view.View;
import android.widget.TextView;

import com.jude.easyrecyclerview.adapter.BaseViewHolder;
import com.zc.zby.basicframedemo.R;
import com.zc.zby.basicframedemo.greendao.bean.UserInfo;

public class UserViewHolder extends BaseViewHolder<UserInfo> {

    private final TextView mTvName;
    private final TextView mTvAge;
    private final TextView mTvSex;

    public UserViewHolder(View view) {
        super(view);
        mTvName = $(R.id.tv_name);
        mTvAge = $(R.id.tv_age);
        mTvSex = $(R.id.tv_sex);
    }

    @Override
    public void setData(UserInfo data) {
        super.setData(data);
        mTvName.setText(data.getName());
        mTvAge.setText(data.getAge() + "");
        mTvSex.setText(data.getSex() == 1 ? "男" : "女");
    }
}
